package com.hxexp.weixin.mvc.register.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hxexp.weixin.common.exception.APIException;
import com.hxexp.weixin.common.exception.ServiceException;
import com.hxexp.weixin.hpe.api.register.RegisterAPI;
import com.hxexp.weixin.hpe.api.register.model.RegisterParamBean;
import com.hxexp.weixin.hpe.api.register.model.RegisterResultBean;
import com.hxexp.weixin.mvc.register.service.RegisterService;

/**
 * 注册服务实现类
 *
 * @author li.jiang
 *
 */
@Service
public final class RegisterServiceImpl implements RegisterService {
    @Autowired
    private RegisterAPI registerAPI;

    /* (non-Javadoc)
     * @see com.hxexp.weixin.mvc.register.service.RegisterService#register(com.hxexp.weixin.model.hpe.login.RegisterJaxb)
     */
    @Override
    public RegisterResultBean register(RegisterParamBean registerParamBean) throws ServiceException {
        RegisterResultBean registerResult = null;
        try {
            registerResult = registerAPI.register(registerParamBean);
        } catch (APIException e) {
            throw new ServiceException(e);
        }
        return registerResult;
    }
}
